<template>
    <div id="ClearHB">   
        <div v-for="item in msg" class="newInfo">
            <h4>{{item.title}}</h4>
            <p>发布时间：{{item.add_time | filDate }}&nbsp;&nbsp;&nbsp;&nbsp;点击量:{{&nbsp;item.click}}</p>
            <div v-html="item.content"></div>
        </div>
        <!--评论组件 向子组件传递id值 -->
        <common :nowId="id"></common>
    </div>
</template>
<script>
// 导入公共评论组件
import common from '../common/common.vue'
export default {
    // 注册组件
    components:{
        common,  
    },
    data: function() {	
        return {
            msg:'',
            id:0,
        }
    },
    methods: {
        getData: function () {
            const url = this.$myurl.url ;
            this.id = this.$route.params.id;
            this.$http.get( url + '/api/getnew/' + this.id ).then(res=>{
                if (res.body.status != 0 ) {
                    this.$toast('网络错误');
                    return ;
                }
                this.msg = res.body.message;
            })
        }
    },
    created(){
        this.getData();
    }
}
</script>

<style scoped>
.newInfo > h4 {
    font-size: 16px;
    margin: 10px 0 20px 0 ;
    color: #000;
}
.newInfo{
    padding: 10px;
}
</style>